package com.bwie.controller;

import com.bwie.pojo.Order;
import com.bwie.pojo.Prod;
import com.bwie.pojo.ProdAtta;
import com.bwie.pojo.ProdInfo;
import com.bwie.service.OrderService;
import com.bwie.vo.PageInfoVo;
import com.bwie.vo.ProdVo;
import com.bwie.service.ProdService;
import com.bwie.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @projectName: server-day0718-pay
 * @package: com.bwie.controller
 * @className: ProdController
 * @author: 陈彤彤
 * @description: TODO
 * @date: 2025/7/19 9:29
 * @version: 1.0
 */
@RestController
@RequestMapping("/prod/prod")
@Api(tags = "商品管理")
public class ProdController {

    @Autowired
    ProdService prodService;

    /**
    * @param prodVo:
    * @return Result
    * @author :陈彤彤
    * @description 商品分页列表
    * @date 2025/7/19 9:34
    */
    @ApiOperation(value = "商品分页列表")
    @PostMapping("/prodList")
    public Result prodList(@RequestBody ProdVo prodVo){
        return prodService.prodList(prodVo);
    }

    /**
    * @param ids:
    * @return Result
    * @author :陈彤彤
    * @description 批量删除商品信息
    * @date 2025/7/22 16:26
    */
    @ApiOperation(value = "批量删除商品信息")
    @PostMapping("/deleteBath")
    public Result deleteBath(@RequestBody List<Integer> ids){
        return prodService.deleteBath(ids);
    }

    /**
    * @param prodAtta:
    * @return Result
    * @author :陈彤彤
    * @description 添加商品附件信息
    * @date 2025/7/22 20:10
    */
    @ApiOperation(value = "添加商品附件信息")
    @PostMapping("/addProdAtta")
    public Result addProdAtta(@RequestBody ProdAtta prodAtta){
        return prodService.addProdAtta(prodAtta);
    }

    /**
    * @param typeId:
    * @return Result
    * @author :陈彤彤
    * @description 字典表信息查询
    * @date 2025/7/22 21:24
    */
    @ApiOperation(value = "字典表信息查询")
    @PostMapping("/dictList/{typeId}")
    public Result dictList(@PathVariable(name = "typeId")Integer typeId){
        return prodService.dictList(typeId);
    }

    /**
     * @param :
     * @return Result
     * @author :陈彤彤
     * @description 查询品牌信息
     * @date 2025/7/22 21:32
     */
    @ApiOperation(value = "查询品牌信息")
    @PostMapping("/selectBrand")
    public Result selectBrand(){
        return prodService.selectBrand();
    }

    /**
    * @param :
    * @return Result
    * @author :陈彤彤
    * @description 查询单位信息
    * @date 2025/7/22 21:32
    */
    @ApiOperation(value = "查询单位信息")
    @PostMapping("/selectUnit")
    public Result selectUnit(){
        return prodService.selectUnit();
    }

    /**
     * @param :
     * @return Result
     * @author :陈彤彤
     * @description 查询标签信息
     * @date 2025/7/22 21:32
     */
    @ApiOperation(value = "查询标签信息")
    @PostMapping("/selectTag")
    public Result selectTag(){
        return prodService.selectTag();
    }

    /**
     * @param :
     * @return Result
     * @author :陈彤彤
     * @description 查询供应商信息
     * @date 2025/7/22 21:32
     */
    @ApiOperation(value = "查询供应商信息")
    @PostMapping("/selectDealer")
    public Result selectDealer(){
        return prodService.selectDealer();
    }

    /**
    * @param :
    * @return Result
    * @author :陈彤彤
    * @description 查询类型树信息
    * @date 2025/7/23 9:37
    */
    @ApiOperation(value = "查询类型树信息")
    @PostMapping("/selectTypeTree")
    public Result selectTypeTree(){
        return prodService.selectTypeTree();
    }

    /**
    * @param prod:
    * @return Result
    * @author :陈彤彤
    * @description 添加商品信息
    * @date 2025/7/23 10:23
    */
    @ApiOperation(value = "添加商品信息")
    @PostMapping("/addProd")
    public Result addProd(@RequestBody @Validated Prod prod){
        return prodService.addProd(prod);
    }

    /**
    * @param pageInfoVo:
    * @return Result
    * @author :陈彤彤
    * @description 商品明细分页列表
    * @date 2025/7/25 20:03
    */
    @ApiOperation(value = "商品明细分页列表")
    @PostMapping("/prodInfoList")
    public Result prodInfoList(@RequestBody PageInfoVo pageInfoVo){
        return prodService.prodInfoList(pageInfoVo);
    }

    /**
    * @param prodInfo:
    * @return Result
    * @author :陈彤彤
    * @description 添加商品明细
    * @date 2025/7/25 20:55
    */
    @ApiOperation(value = "添加商品明细")
    @PostMapping("/addProdInfo")
    public Result addProdInfo(@RequestBody ProdInfo prodInfo){
        return prodService.addProdInfo(prodInfo);
    }
}
